/*
 * ChapterWithAnchor.java
 *
 *  created: 20.8.2011
 *  charset: UTF-8
 *  license: MIT (X11) (See LICENSE file for full license)
 */
package cz.mp.k3bg.core;


/**
 * Třída {@code ChapterWithAnchor} reprezentuje kapitolu v HTML
 * (tagy {@literal H1 - H6}), na kterou vede odkaz.
 * 
 * @author Martin Pokorný
 * @version 0.1
 * @see ChaptersWithAnchorFinder
 */
public class ChapterWithAnchor {

//    private static final boolean DEBUG = false;
//    private static final Logger logger =
//            LoggerManager.getLogger(ChapterWithAnchor.class, DEBUG);
    
    private String chapterName;
    private String anchorName;
    private int level;

    /**
     * 
     * @param chapterTitle
     * @param anchorName 
     */
    public ChapterWithAnchor(String chapterName, String anchorName) {
        this(chapterName, anchorName, 0);
    }

    /**
     * 
     * @param chapterName
     * @param anchorName
     * @param level 
     */
    public ChapterWithAnchor(String chapterName, String anchorName, int level) {
        if (chapterName == null) {
            throw new IllegalArgumentException("chapterName=null");
        }
        this.chapterName = chapterName;
        
        if (anchorName == null) {
            throw new IllegalArgumentException("anchor=null");
        }        
        this.anchorName = anchorName;
        
        this.level = level;
    }

    /**
     * 
     * @return 
     */
    public String getAnchorName() {
        return anchorName;
    }

    /**
     * 
     * @return 
     */
    public int getLevel() {
        return level;
    }

    /**
     * 
     * @param level 
     */
    public void setLevel(int level) {
        this.level = level;
    }
    
    /**
     * 
     * @return 
     */
    public String getChapterName() {
        return chapterName;
    }

    /**
     * 
     * @return 
     */
    @Override
    public String toString() {
        return chapterName + " (#" + anchorName + " : H" + level + ")  ";
    }
        
}   // ChapterWithAnchor
